/**
 * @project_name staff_vehicle
 * @package_name com.ssh.web.admin
 * @desc TODO
 * @param
 * @author jack
 * @date 2013-4-26
 * @time 下午9:07:37
 */
package com.ssh.web.admin;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.ssh.entity.InnerVehicle;
import com.ssh.model.pdata.InnerDiverMPData;
import com.ssh.model.pdata.StaffDepApplyCarMData;
import com.ssh.model.pdata.StaffMPData;
import com.ssh.ser.admin.StaffManageSerI;

/**
 * @author jack
 *
 */
public class QueryStaffAction extends ActionSupport {
	/**
	 * TODO
	 */

	private static final long serialVersionUID = 1L;
	private String address;
	private Date birthday;
	private String departmentName;
	private String education;
	private String email;
	private String firstName;
	private String idNumber;
	private List<InnerDiverMPData> innerDriverList;
	private String lastName;
	private String marriage;
	private String OpSId;
	private String picture;
	private String politicsState;
	private String sex;
	private String staffId;
	private StaffManageSerI staffManageSerI;
	private StaffMPData staffMPData;
	private List<StaffMPData> staffMPList;
	private Long staffTel;
	private String innerDriverId;
	private String innerDriverState;
	private List<InnerVehicle> innerVehicleList;//传递数据
	private List<StaffDepApplyCarMData> staffAMPDataList;//传递数据

	/*
	 * (non-Javadoc)
	 *
	 * @see com.opensymphony.xwork2.ActionSupport#execute()
	 */
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		System.out.println("hello world");
		try {
			System.out.println("OpSId=" + OpSId + "sex=" + sex
					+ "departmentName=" + departmentName);
			query();
		} catch (Exception e) {
			e.printStackTrace();
			return "error";

		}
		return "ok";
	}

	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}

	/**
	 * @return the birthday
	 */
	public Date getBirthday() {
		return birthday;
	}

	/**
	 * @return the departmentName
	 */
	public String getDepartmentName() {
		return departmentName;
	}

	/**
	 * @return the education
	 */
	public String getEducation() {
		return education;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @return the firstName
	 */
	public String getFirstName() {
		return firstName;
	}

	/**
	 * @return the idNumber
	 */
	public String getIdNumber() {
		return idNumber;
	}

	/**
	 * @return the innerDriverList
	 */
	public List<InnerDiverMPData> getInnerDriverList() {
		return innerDriverList;
	}

	/**
	 * @return the lastName
	 */
	public String getLastName() {
		return lastName;
	}

	/**
	 * @return the marriage
	 */
	public String getMarriage() {
		return marriage;
	}

	/**
	 * @return the opSId
	 */
	public String getOpSId() {
		return OpSId;
	}

	/**
	 * @return the picture
	 */
	public String getPicture() {
		return picture;
	}

	/**
	 * @return the politicsState
	 */
	public String getPoliticsState() {
		return politicsState;
	}

	/**
	 * @return the sex
	 */
	public String getSex() {
		return sex;
	}

	/**
	 * @return the staffId
	 */
	public String getStaffId() {
		return staffId;
	}

	/**
	 * @return the staffManageSerI
	 */
	public StaffManageSerI getStaffManageSerI() {
		return staffManageSerI;
	}

	/**
	 * @return the staffMPData
	 */
	public StaffMPData getStaffMPData() {
		return staffMPData;
	}

	/**
	 * @return the staffMPList
	 */
	public List<StaffMPData> getStaffMPList() {
		return staffMPList;
	}

	/**
	 * @return the staffTel
	 */
	public Long getStaffTel() {
		return staffTel;
	}

	public int query() {
		if (OpSId != null && !OpSId.equals("")) {
			staffMPList = new ArrayList<StaffMPData>();
			staffMPList.add((StaffMPData) staffManageSerI
					.viewStaffMPDataById(OpSId));
			return 1;
		}

		if (departmentName.equals("not") && sex.equals("not")) {
			staffMPList = staffManageSerI.viewAllStaffMPData();
			return 0;
		} else if (!departmentName.equals("not") && !sex.equals("not")) {
			staffMPList = staffManageSerI.viewStaffMpData(sex, departmentName);
			return 2;
		}
		 else if (!departmentName.equals("not")) {
				staffMPList = staffManageSerI.viewStaffMPDataDep(departmentName);
				return 1;
			} else if (!sex.equals("not")) {
				staffMPList = staffManageSerI.viewStaffMPDataSex(sex);
				return 1;
			}
		return 100;
	}

	/**
	 * @param address
	 *            the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @param birthday
	 *            the birthday to set
	 */
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	/**
	 * @param departmentName
	 *            the departmentName to set
	 */
	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	/**
	 * @param education
	 *            the education to set
	 */
	public void setEducation(String education) {
		this.education = education;
	}

	/**
	 * @param email
	 *            the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @param firstName
	 *            the firstName to set
	 */
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	/**
	 * @param idNumber
	 *            the idNumber to set
	 */
	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}

	/**
	 * @param innerDriverList
	 *            the innerDriverList to set
	 */
	public void setInnerDriverList(List<InnerDiverMPData> innerDriverList) {
		this.innerDriverList = innerDriverList;
	}

	/**
	 * @param lastName
	 *            the lastName to set
	 */
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	/**
	 * @param marriage
	 *            the marriage to set
	 */
	public void setMarriage(String marriage) {
		this.marriage = marriage;
	}

	/**
	 * @param opSId
	 *            the opSId to set
	 */
	public void setOpSId(String opSId) {
		OpSId = opSId;
	}

	/**
	 * @param picture
	 *            the picture to set
	 */
	public void setPicture(String picture) {
		this.picture = picture;
	}

	/**
	 * @param politicsState
	 *            the politicsState to set
	 */
	public void setPoliticsState(String politicsState) {
		this.politicsState = politicsState;
	}

	/**
	 * @param sex
	 *            the sex to set
	 */
	public void setSex(String sex) {
		this.sex = sex;
	}

	/**
	 * @param staffId
	 *            the staffId to set
	 */
	public void setStaffId(String staffId) {
		this.staffId = staffId;
	}

	/**
	 * @param staffManageSerI
	 *            the staffManageSerI to set
	 */
	public void setStaffManageSerI(StaffManageSerI staffManageSerI) {
		this.staffManageSerI = staffManageSerI;
	}

	/**
	 * @param staffMPData
	 *            the staffMPData to set
	 */
	public void setStaffMPData(StaffMPData staffMPData) {
		this.staffMPData = staffMPData;
	}

	/**
	 * @param staffMPList
	 *            the staffMPList to set
	 */
	public void setStaffMPList(List<StaffMPData> staffMPList) {
		this.staffMPList = staffMPList;
	}

	/**
	 * @param staffTel
	 *            the staffTel to set
	 */
	public void setStaffTel(Long staffTel) {
		this.staffTel = staffTel;
	}

	public String viewDriver() {
		// TODO Auto-generated method stub
		System.out.println("hello world");
		try {
			if(innerDriverId==null)
				innerDriverList = staffManageSerI.getInnerDriverByState("waiting");
			else if (innerDriverId.equals(""))
				innerDriverList = staffManageSerI.getInnerDriverByState("waiting");
			else if (!innerDriverId.equals("")){
				innerDriverList = new ArrayList<InnerDiverMPData>();
				innerDriverList.add(staffManageSerI.getInnerDriverById(innerDriverId));
			}

		} catch (Exception e) {
			e.printStackTrace();
			return "error";

		}
		return "viewDriver";
	}

	/**
	 * @return the innerDriverId
	 */
	public String getInnerDriverId() {
		return innerDriverId;
	}

	/**
	 * @param innerDriverId the innerDriverId to set
	 */
	public void setInnerDriverId(String innerDriverId) {
		this.innerDriverId = innerDriverId;
	}

	/**
	 * @return the innerDriverState
	 */
	public String getInnerDriverState() {
		return innerDriverState;
	}

	/**
	 * @param innerDriverState the innerDriverState to set
	 */
	public void setInnerDriverState(String innerDriverState) {
		this.innerDriverState = innerDriverState;
	}

	/**
	 * @return the innerVehicleList
	 */
	public List<InnerVehicle> getInnerVehicleList() {
		return innerVehicleList;
	}

	/**
	 * @param innerVehicleList the innerVehicleList to set
	 */
	public void setInnerVehicleList(List<InnerVehicle> innerVehicleList) {
		this.innerVehicleList = innerVehicleList;
	}

	/**
	 * @return the staffAMPDataList
	 */
	public List<StaffDepApplyCarMData> getStaffAMPDataList() {
		return staffAMPDataList;
	}

	/**
	 * @param staffAMPDataList the staffAMPDataList to set
	 */
	public void setStaffAMPDataList(List<StaffDepApplyCarMData> staffAMPDataList) {
		this.staffAMPDataList = staffAMPDataList;
	}

}
